package com.woniu.woniuproject.web;

import com.github.pagehelper.PageInfo;
import com.woniu.woniuproject.entity.LooseLabel;
import com.woniu.woniuproject.entity.Product;
import com.woniu.woniuproject.entity.User;
import com.woniu.woniuproject.service.OfficiallogoService;
import com.woniu.woniuproject.utils.ResponseResult;
import com.woniu.woniuproject.vo.LooselabeVo;
import com.woniu.woniuproject.vo.OfficiallogoVo;
import com.woniu.woniuproject.vo.PrWebVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * 功能描述:<br>
 * 〈〉
 *
 * @author 徐威
 * @create 2020/11/20
 * @since 1.0.0
 */
@Controller
@RequestMapping("Officiallogo")
public class OfficiallogoController {
    @Autowired
    OfficiallogoService officiallogoService;
    @PostMapping("/query")
    @ResponseBody
    public ResponseResult<PageInfo<Product>> queryOfficiallogo(OfficiallogoVo officiallogoVo){
        return new ResponseResult<>(officiallogoService.queryByWeb(officiallogoVo));
    }
    @PostMapping("/queryLooselabe")
    @ResponseBody
    public ResponseResult<PageInfo<LooseLabel>> queryqueryLooselabe(LooselabeVo looselabeVo){
        return new ResponseResult<>(officiallogoService.queryByLooselabe(looselabeVo));
    }
    @RequestMapping("/queryall")
    public String queryByUser(HttpServletRequest request, Map map, String type){
        User user = (User) request.getSession().getAttribute("loginUser");
        map.put("type",type);


        List<PrWebVo> product_accounts = officiallogoService.queryProduct_accountall(user.getId(),type);
        map.put("product_accounts",product_accounts);
        return "usercenter-investcontrol-investrecord.html";
    }
}
